//  Copyright (c) 2011 M.A. (Thijs) van den Berg, http://sitmo.com/
//
//  Use, modification and distribution are subject to the MIT Software License. 
// (See accompanying file LICENSE.txt or copy at http://www.bmlib.org/LICENSE.txt)

#include <iostream>

#include <bmlib/gbm_process.hpp>
#include <bmlib/at_fixed_time.hpp>
using namespace bmlib;

int main( int argc, char* argv[] )
{
    // initialize a Geometric Brownian motion struct
    gbm_process<double> S(100.0, 0.03, 0.25); // initial value 100, drift 3%, vol 25%

    // calculate the probability of the gbm begin below K at some future fixed point in time.
    double t = 1.5;
    double K = 102;    
    double ans = cdf( at_fixed_time<gbm_process<double> >(S, t), K );
    
    // show results
    std::cout   << "Probability of the stock being below " << K << " at t = " << t << ": "
                << std::setprecision(6) << std::setw(10) << ans << std::endl;
};